package com.example.springboot.security.dao;

import com.example.springboot.security.entity.SysUser;
import com.example.springboot.security.entity.SysUser;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.Repository;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Component;

@Component
public interface UserRepository extends Repository<SysUser, Integer> {

	/**
	 * 查询以get|find|read开头； 条件属性以首字母大写
	 */
	public SysUser findByUserName(String userName);

	/**
	 * 通过jpa hql语句查询
	 */
	@Query(value = "from User where userName=:cn")
	public SysUser findByUserName2(@Param("cn") String userName);
}
